Writing a Try Statement
A Try statement is two-part compound statement. The first part, which begins with the wordtry
, is a collection of AppleScript statements. The second part, which begins with the wordson error
, is an error handler--a series of statements that is executed if any of the statements in the first part causes an error message. The Try statement ends with the wordend
(followedoptionally by
error
ortry
).The error handler can include up to five parameter variables (also called formal parameters) that represent the actual information sent in the error message when the error occurs. When the error handler is called, the parameter variables become local variables in the error handler.